import 'package:plugin_echat/ec_vis_evt.dart';

/// Copyright ©2021 Guangzhou Tianyi Network Information Co., Ltd. All rights reserved.
/// Project: PluginEchat
/// Created By Jisen
/// Date: 2021/8/24 下午2:49
/// Class description: ec_access_conditions - 打开对话窗口 - 对话页参数condition


class ECAccessConditions {
  String? uid; // 唯一标识,解除绑定会员绑定需要传递
  String? metaData; // 会员数据参数
  String? myData; // 自定义扩展参数
  String? lan; // 自定义对话窗口语言
  String? routeEntranceId; // 咨询入口id
  ECVisEvt? visEvt; // 图文消息
  String? echatTag; // 入口/入口标签
  String? pushInfo; // 消息推送字段
  String? acdStaffId; // 指派接待客服的ID
  String? acdType; // 分配优先级，0-优先，1-指派


  ECAccessConditions({
    this.uid,
    this.metaData,
    this.myData,
    this.lan,
    this.routeEntranceId,
    this.visEvt,
    this.echatTag,
    this.pushInfo,
    this.acdStaffId,
    this.acdType,
  });

  factory ECAccessConditions.fromJson(Map<String, dynamic> json) {
    if (json == null) return null!;
    return ECAccessConditions(
      uid: json['uid'],
      metaData: json['metaData'],
      myData: json['myData'],
      lan: json['lan'],
      routeEntranceId: json['routeEntranceId'],
      visEvt: ECVisEvt.fromJson(json['urlForStaff']),
      echatTag: json['echatTag'],
      pushInfo: json['pushInfo'],
      acdStaffId: json['acdStaffId'],
      acdType: json['acdType'],
    );
  }

  Map<String, dynamic> toJson() {
    Map<String, dynamic> json = new Map();

    if (uid != null)
      json.putIfAbsent('uid', () => uid);
    if (metaData != null)
      json.putIfAbsent('metaData', () => metaData);
    if (myData != null)
      json.putIfAbsent('myData', () => myData);
    if (lan != null)
      json.putIfAbsent('lan', () => lan);
    if (routeEntranceId != null)
      json.putIfAbsent('routeEntranceId', () => routeEntranceId);
    if (visEvt != null)
      json.putIfAbsent('visEvt', () => visEvt!.toJson());
    if (echatTag != null)
      json.putIfAbsent('echatTag', () => echatTag);
    if (pushInfo != null)
      json.putIfAbsent('pushInfo', () => pushInfo);
    if (acdStaffId != null)
      json.putIfAbsent('acdStaffId', () => acdStaffId);
    if (acdType != null)
      json.putIfAbsent('acdType', () => acdType);
    return json;
  }
}
